<template>
	<view class="box">
		<view class="selectbox">
			<view class="text">
				<text>选择时间</text>
				<image  class="img"  src="../../../static/99.png" mode=""></image>
			</view>
			<view class="ipt" style="border-bottom: none;" >
				<input  @click="aaa"  disabled="false" v-model="txt"  style="border: 1rpx solid #aaa;"  type="text" placeholder="请选择月份">
			</view>
			<view class="text" style="display: flex; justify-content: space-between; border-bottom: none;padding: 0 20rpx; color: #333; font-size: 28rpx;">
				<text>项目数量：{{xiang_mu}}</text>
				<text>已实施场次：{{shi_shi}}</text>
			</view>
		</view>
		
		<view  v-for="item in list"  :key="item.id"   class="probox"  @click="todetail(item)">
			{{item.name}}
		</view>
		<u-picker v-model="show" mode="time" :params="params" @confirm="onConfirm"></u-picker>
		
	</view>
</template>

<script>
import { regionexaminecchakan,agentSees } from '@/request/api.js';
export default {
	data() {
		return {
			type: 1,
			page: 1,
			pageShow: false,
			list: [],
			showIndex: 0,
			txt:'',
			show: false,
			params: {
				year: true,
				month: true,
			},
			year:'',
			month:'',
			xiang_mu:'',  //项目数量
			shi_shi:''   //实施总数
		};
	},
	onReachBottom() {
		this.page+=1
		this.getinfo(this.page)
		
	},
	methods:{
		todetail(e){
			let info = JSON.stringify(e)
			uni.navigateTo({
				url:'shuju_detail?info=' + info
			})
			
		},
		aaa(){
			this.show = !this.show
		},
		onConfirm(e) {
			this.year = e.year
			this.month = e.month
			this.txt = e.year +'-'+ e.month
			
			this.page = 1
			this.list =[]
			this.getinfo(this.page)

		},
		
		getinfo(page){
			let that = this
			let data = {
				page: page,
				time: that.txt,
				region_id: uni.getStorageSync('regionMessage').id
			};
			agentSees(data).then(res => {
				if(res.code == 1){
					if(res.data.data){
						this.list = this.list.concat(res.data.data)
					}
					this.xiang_mu = res.data.xiang_mu
					this.shi_shi = res.data.shi_shi
				}
			})
		}
	}

};
</script>

<style lang="scss">
	page{
		background: #f5f5f5;
	}
	.box{
		width: 100%;
	}
	.selectbox{
		width: 670rpx;
		height: 320rpx;
		box-sizing: border-box;
		margin: 50rpx auto;
		background: #FFFFFF;
		box-shadow: 0px 1px 4px 0px rgba(156, 161, 173, 0.5);
		border-radius: 16rpx;
	}
	.probox{
		width: 670rpx;
		height: 100rpx;
		box-sizing: border-box;
		background: #FFFFFF;
		box-shadow: 0px 1px 4px 0px rgba(156, 161, 173, 0.5);
		border-radius: 12rpx;
		margin: 20rpx auto;
		padding-left: 20rpx;
		line-height: 100rpx;
		 white-space:nowrap; //强制在一行显示文本
		 overflow:hidden; //溢出内容隐藏
		 text-overflow:ellipsis; //溢出的 ... 代替
		}
	.ipt{
		width: 670rpx;
		box-sizing: border-box;
		padding-left: 5%;
		height: 100rpx;
		// border: 1px solid #000;
		font-size: 30rpx;
		border-bottom: 1px solid #1855F6;
		color: #1855F6;
		text-align: left;
		line-height: 80rpx;
		position: relative;
	}
	.ipt input{
		width: 600rpx;
		height: 80rpx;
		box-sizing: border-box;
		background: #FFFFFF;
		border: 2px solid #CBCDD2;
		border-radius: 10rpx;
		margin-top: 20rpx;
		padding-left: 20rpx;
	}
	.text{
		width: 670rpx;
		box-sizing: border-box;
		padding-left: 5%;
		height: 80rpx;
		// border: 1px solid #000;
		font-size: 30rpx;
		border-bottom: 1px solid #1855F6;
	    color: #1855F6;
		text-align: left;
		line-height: 80rpx;
		position: relative;
	}
	.text .img{
		width: 32rpx;
		height: 13rpx;
		position: absolute;
		bottom: 0;
		left: 0;
	}

</style>
